<template xmlns:el-col="http://www.w3.org/1999/html">
  <div>
    <el-col style="margin-bottom: 20px" :span="24">
      <el-col :span="24" style="margin-bottom: 5px">
        <div style="float: left"><h2>搜索</h2></div>
        <!--<div style='float: right;font: 16px / 26px "Microsoft YaHei";'>更多>>></div>-->
      </el-col>
      <hr/>
      <el-col :span="24" style="padding-top: 10px;padding-bottom: 10px" :key="items.id"
              v-for="(items,index) in contentMap">
        <el-col :span="24" style="padding-bottom: 10px">
          <el-col :span="5" >
            <img :src="$image + items.cover" style="width: 100%;height: 100px"/>
          </el-col>
          <el-col :span="19" style="padding-left: 10px">
            <el-col :span="24" style='font: 24px / 26px "Microsoft YaHei";padding-bottom: 5px'>
              <span href="#" style=" text-decoration: none;color: #000;" @click="toDts(items.title,items)">{{items.title}}</span>
              <!--<el-button type="text">{{items.title}}</el-button>-->
            </el-col>
            <el-col :span="24" style='font: 14px / 24px "Microsoft YaHei";'>
              {{items.brief_introduction}}
            </el-col>
          </el-col>
        </el-col>
        <hr style="border-top-style: dashed;"/>
      </el-col>


    </el-col>
  </div>
</template>

<script>
  export default {
    name: "userDefault",
    data() {
      return {
        activeIndex: '1',
        addParam: {
          queryName: ''
        },
        contentTypeDts: {},
        initSelect: {
          content_type: [{label: '饲养', value: 1}, {label: '医疗', value: 2}, {label: '训练', value: 3}],
        },
        contentRoute: {
          0: '/more/feeding/contentDts/',
          1: '/more/medicalTreatment/contentDts/',
          2: '/more/train/contentDts/',
        },
        contentMap: []
      }
    },
    props: ['name'],
    created() {
      this.contentTypeDts = this.initSelect.content_type[this.type]
      this.initList()
    },
    methods: {
      initList() {
        this.service.get('/tbArticleInformation/getDataByName?title=' + this.name)
          .then(result => {
            let data = result.data.data
            console.log(data)
            this.contentMap = data
          })
      },
      handleSelect(key, keyPath) {
        this.$router.push(key)
      },
      toDts(name, item) {
        let json = JSON.stringify(item);
        sessionStorage.setItem("contentDts", json)
        this.$router.push({path: this.contentRoute[item.content_type]  + name})
      }
    }
  }
</script>

<style scoped>

</style>
